﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;


namespace WindowsGame1
{
    class TiroManager
    {

        Texture2D tiro_img;

        List<Tiro> Tiros;
        public TiroManager() { }

        public void Load(ContentManager Content)
        {

            Tiros = new List<Tiro>();
            tiro_img = Content.Load<Texture2D>("tiro");
        }


        public void AddShot(Vector2 Position)
        {
            Tiros.Add(new Tiro(
                           tiro_img,

                           new Rectangle(0, 0, tiro_img.Width,
                               tiro_img.Height),
                               new Vector2(Position.X,
                                   Position.Y - tiro_img.Height / 2)));
        }
        
        public void RemoveShot()
        {

        }


        public void Update()
        {
            if (Tiros != null)
            {

                foreach (Tiro tiro in Tiros)
                {
                    if (tiro != null) tiro.Update();
                }
            }

        }


        public void Draw(SpriteBatch spriteBatch)
        {

            if (Tiros != null)
            {

                foreach (Tiro tiro in Tiros)
                {
                    if (tiro != null) tiro.Draw(spriteBatch);
                }
            }
        }

    }
}
